import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  // 映射关系：path->component
  routes: [
    {
      path: "/",
      redirect: "/home"
    },
    {
      path: "/home",
      component: () => import("@/views/Home.vue")
    },
    {
      path: "/category",
      component: () => import("@/views/Category.vue")
    },
    {
      path: "/cart",
      component: () => import("@/views/Cart.vue")
    },
    {
      path: "/profile",
      component: () => import("@/views/Profile.vue")
    },
    {
      path: "/login",
      component: () => import("@/views/Login.vue")
    },
    {
      path: "/:pathMatch(.*)*",
      component: () => import("@/views/404.vue")
    }
  ]
})

export default router
